﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApplication1.Servidor1;

namespace WebApplication1
{
    public partial class VerSaldos : System.Web.UI.Page
    {
        Service1 servidor;

        protected void Page_Load(object sender, EventArgs e)
        {
            servidor = (Service1)Session["Server"];

            if (!Page.IsPostBack)
            {
                if (Session["NombreEmpresaUsuario"] == null)
                    Response.Redirect("Login.aspx");

                if (Session["Server"] != null)
                {
                    string empresa = Session["NombreEmpresaUsuario"].ToString();
                    List<string> listOfNames = servidor.ConsultarEmpresa(6, empresa).ToList();
                    DropDownList1.DataSource = listOfNames;
                    DropDownList1.DataBind();
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            String socio = DropDownList1.SelectedValue.ToString();
            Label1.Text = Convert.ToString(servidor.Obtener_Saldo_SocioNegocio(socio, Session["NombreEmpresaUsuario"].ToString()));
        }
    }
}